package org.idea.iedis.framework.server.dict;

/**
 * @Author linhao
 * @Date created in 11:43 上午 2021/4/30
 */
public class Entry<K,V> implements IMap<K,V> {

    private K key;

    private V val;

    private Entry<K,V> next;

    @Override
    public V get(K key) {
        return this.val;
    }

    @Override
    public V put(K key, V val) {
        this.key = key;
        this.val = val;
        return this.val;
    }

    public K getKey() {
        return key;
    }

    public V getVal() {
        return val;
    }

    public Entry<K, V> getNext() {
        return next;
    }

    public void setKey(K key) {
        this.key = key;
    }

    public void setVal(V val) {
        this.val = val;
    }

    public void setNext(Entry<K, V> next) {
        this.next = next;
    }

    public Entry(K key, V val, Entry<K, V> next) {
        this.key = key;
        this.val = val;
        this.next = next;
    }

    @Override
    public String toString() {
        return "Entry{" +
                "key=" + key +
                ", val=" + val +
                ", next=" + next +
                '}';
    }
}
